<?php
	
	class Battleship {

		private $id;
		private $name;
		private $size;
                private $picture;
                private $location;
                private $hitpoint;
                
		public function __get($attr){
			return $this->$attr;
		}
            
		public function setId($id) {
			$this->id = $id;
		}
		
		public function setName($name) {
			$this->name = $name;
		}

		public function setSize($size) {
			$this->size = $size;
		}
                
                public function setPicture($picture) {
			$this->picture = $picture;
		}
                
                public function setLocation($location) {
			$this->location = $location;
		}
                
                public function setHitpoint($hitpoint) {
			$this->hitpoint = $hitpoint;
		}
                
                public function generateAircraftCarrier(){
                    $this->id= 1;
                    $this->name = "Aircraft";
                    $this->size = 5;
                    $this->picture = "aircraft.png";
                    $this->position = array("x" => "", "y" => "");
                    $this->hitpoint = $this->size;
                    return $this;
                }
                
                public function generateBattleship(){
                    $this->id= 2;
                    $this->name = "Battleship";
                    $this->size = 4;
                    $this->picture = "battleship.png";
                    $this->position = array("x" => "", "y" => "");
                    $this->hitpoint = $this->size;
                    return $this;
                }
                
                public function generateSubmarine(){
                    $this->id= 3;
                    $this->name = "Submarine";
                    $this->size = 3;
                    $this->picture = "cruiser.png";
                    $this->position = array("x" => "", "y" => "");
                    $this->hitpoint = $this->size;
                    return $this;
                }
                
                public function generateCruiser(){
                    $this->id= 4;
                    $this->name = "Cruiser";
                    $this->size = 3;
                    $this->picture = "cruiser.png";
                    $this->position = array("x" => "", "y" => "");
                    $this->hitpoint = $this->size;
                    return $this;
                }
                
                public function generateDestroyer(){
                    $this->id= 5;
                    $this->name = "Destroyer";
                    $this->size = 2;
                    $this->picture = "destroyer.png";
                    $this->position = array("x" => "", "y" => "");
                    $this->hitpoint = $this->size;
                    return $this;
                }
                
                public function generateShips(){
                    $pa = $this->generateAircraftCarrier();
                    $ships = array(
                        $pa->id => array(
                            $pa->name,
                            $pa->size, 
                            $pa->picture,
                            $pa->position,
                            $pa->size
                            )
                    );
                    $cr = $this->generateBattleship();
                    $ships += array(
                        $cr->id => array($cr->name,
                            $cr->size,
                            $cr->picture,
                            $cr->position,
                            $cr->size
                            )
                    );
                    $ct = $this->generateCruiser();
                    $ships += array(
                        $ct->id => array($ct->name,
                            $ct->size,
                            $ct->picture,
                            $ct->position,
                            $ct->size
                            )
                    );
                    $sm = $this->generateSubmarine();
                    $ships += array(
                        $sm->id => array($sm->name,
                            $sm->size,
                            $sm->picture,
                            $sm->position,
                            $sm->size
                            )
                    );
                    $to = $this->generateDestroyer();
                    $ships += array(
                        $to->id => array($to->name,
                            $to->size,
                            $to->picture,
                            $to->position,
                            $to->size
                            )
                    );
                    return $ships;
                }
                
                public function displayPicture($ship) {
                       return $ship[2];
                }

	}
